<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>实例DEMO</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link rel="stylesheet" href="css/style.css">
	</head>
	<body>

		<style>
			.button{
				position: absolute;
				right: 0;
				bottom:0;
				background: red;
				width: 100px;
				height:100px;
				display: block;
				z-index:999;
			}
		</style>
		<div class="web">
			<!--视频封面-->
			<div class="poster">
				<img src="images/poster.png"/>
			</div>

			<!--菊花loading-->
			<div class="loading">
				<img src="images/loading.gif"/>
			</div>


			<div class="button"></div>
		</div>


		<!--<script src="js/vconsole.min.js"></script>-->
		<script src="js/video.js"></script>
		<script type="text/javascript">
            var poster = document.querySelector(".poster");
//            var loading =  document.querySelector(".loading");


            //初始化视频类
			var videoObj = new VideoClass(".web","media/detail.mp4");
//			videoObj.debug = true;	//开启调试模式

            //点击开始初始化视频
            poster.addEventListener("touchstart",touchHandle)

            function touchHandle(){
                poster.style.zIndex = -1;
                poster.style.opacity = 0;
                poster.removeEventListener("touchend",touchHandle);
                videoObj.play(
					//播放结束后执行的回调
                    function(){
                        poster.style.zIndex = 1;
                        poster.style.opacity = 1
                    },
                    //加载完成后执行的回调
					function(){
						setTimeout(function(){
						    videoObj.pause();
						},100);
					}
                );
            }

            var button  =  document.querySelector(".button");
            button.addEventListener("touchstart",function(){
                videoObj.play();
			})
		</script>
		
	</body>
</html>
